<!--
  ~ MIT License
  ~
  ~ Copyright (c) 2021-2022 yangrunkang
  ~
  ~ Author: yangrunkang
  ~ Email: yangrunkang53@gmail.com
  ~
  ~ Permission is hereby granted, free of charge, to any person obtaining a copy
  ~ of this software and associated documentation files (the "Software"), to deal
  ~ in the Software without restriction, including without limitation the rights
  ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  ~ copies of the Software, and to permit persons to whom the Software is
  ~ furnished to do so, subject to the following conditions:
  ~
  ~ The above copyright notice and this permission notice shall be included in all
  ~ copies or substantial portions of the Software.
  ~
  ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  ~ SOFTWARE.
  -->

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      th:replace="index">
<!--css-->
<link th:fragment="css" type="text/css" rel="stylesheet" th:href="${ossStatic} + @{/css/content/list.css}"/>
<!--脚本-->
<script async="async" th:fragment="js" type="text/javascript" th:src="${ossStatic} + @{/js/content/list.js}"></script>
<!--内容-->
<div th:fragment="content">
    <div class="container">
        <div class="row g-2">
            <div class="col-lg-9">
                <div th:include="fragments/index::page_banner"></div>
                <div class="card card-body shadow-sm border-bottom border-2 border-top-0 border-start border-end-0 p-2">
                    <div th:include="fragments/index::page_menu"></div>
                </div>
                <div class="row g-2">
                    <div class="col-lg-3 d-md-none d-none d-xl-block">
                        <div class="card card-body shadow-sm border-bottom border-2 border-top-0 border-start border-end-0 p-2 my-2">
                            <div class="fw-normal border-bottom mb-2 text-black-50">分类 <a class="cv-link text-black-50 float-end" th:href="${commonPageIndexDto.currentRootUrl}"><i class="bi bi-balloon"></i>全部</a></div>
                            <div th:if="${#lists.isEmpty(commonPageIndexDto.tagList)}">
                                <div th:include="fragments/index::empty_content"></div>
                                <div th:include="fragments/index::apply_tag"></div>
                            </div>
                            <ul class="nav nav-pills flex-column" th:if="!${#lists.isEmpty(commonPageIndexDto.tagList)}">
                                <!--如果以后涵盖子类，可以使用展开按钮-->
                                <li th:each="menu : ${commonPageIndexDto.tagList}" class="nav-item">
                                    <a th:class="'nav-link cv-link small p-2 ' + ${menu.tagId}" th:href="@{ ${commonPageIndexDto.currentRootUrl} + '/' + ${menu.tagId}}" th:title="${menu.tagName}" th:inline="text">
                                        <img th:data-src="${menu.icon}" class="lazyload cv-icon" />
                                        [[${menu.tagName}]] <span class="badge bg-gradient rounded-3 fw-normal bg-warning text-dark d-inline-flex float-end">[[${menu.count}]]</span>
                                    </a>
                                </li>
                                <div class="border-top border-1 mt-2" th:include="fragments/index::apply_tag"></div>
                            </ul>
                        </div>
                        <div class="card card-body shadow-sm border-bottom border-2 border-top-0 border-start border-end-0 p-2 mb-2">
                            <a class="cv-link text-black-50" href="/our-home"><span th:include="fragments/icon::earth"></span>暗淡蓝点</a>
                        </div>
                        <div class="card card-body shadow-sm border-bottom border-2 border-top-0 border-start border-end-0 p-2 mb-2">
                            <div th:replace="fragments/business::open_github"></div>
                        </div>
                    </div>
                    <div class="col">
                        <div class="card card-body shadow-sm border-bottom border-2 border-top-0 border-start border-end-0 p-2 my-2" th:include="fragments/index::list_content_dto(${commonPageIndexDto.listContentDto},false)"></div>
                    </div>
                </div>
            </div>
            <div class="col-lg-3">
                <div th:if="${commonPageIndexDto.createContentDesc != null}" th:include="fragments/index::create_content_url(${commonPageIndexDto.createContentDesc})"></div>
                <!--全局搜索-->
                <div th:include="fragments/index::global_search"></div>
                <!--全局个人信息卡片-->
                <div th:include="fragments/index::global_member_info"></div>
                <div th:replace="fragments/index::user_manage_fragment(true)"></div>
                <!--最近一周新增文章-->
                <div class="card card-body shadow-sm border-bottom border-2 border-top-0 border-start border-end-0 p-2 my-2">
                    <div class="fw-normal border-bottom mb-2 text-black-50">最新文章<a class="cv-link text-black-50 float-end" href="/content/new"><i class="bi bi-balloon"></i>全部</a></div>
                    <table class="table table-sm table-borderless mb-0">
                        <tbody>
                        <tr th:if="!${#lists.isEmpty(commonPageIndexDto.latestContentList)}"
                            th:each="content,ite : ${commonPageIndexDto.latestContentList}"
                        >
                            <td class="p-1">
                                <span th:replace="fragments/index::content_manage(${content})"></span>
                            </td>

                            <td class="p-1" style="text-align: right">
                                <a class="flex-shrink-0 text-black-50 cv-link" th:href="'/profile/' + ${content.member.userId}+'/content'"  th:title="${content.member.userName}">
                                    <img class="me-1 img rounded" style="width: 20px;height: 20px" th:src="${content.member.via}" th:alt="${content.member.userName}">
                                </a>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <div th:if="${#lists.isEmpty(commonPageIndexDto.latestContentList)}" th:include="fragments/index::empty_content"></div>
                </div>
                <!--活跃用户-->
                <div class="card card-body shadow-sm border-bottom border-2 border-top-0 border-start border-end-0 p-2 my-2">
                    <div class="fw-normal border-bottom mb-2 text-black-50">最近登录的用户<a class="cv-link text-black-50 float-end" href="/list-user"><i class="bi bi-balloon"></i>全部</a></div>
                    <div class="nav flex-column nav-pills" aria-orientation="vertical" th:if="!${#lists.isEmpty(commonPageIndexDto.memberList)}">
                        <a class="d-flex align-items-center my-1 mb-2 cv-link" th:each="member,ite : ${commonPageIndexDto.memberList}" th:href="@{'/profile/'+${member.userId}+'/content'}" th:title="${member.userName}">
                            <img class="align-self-center me-1 img rounded" style="width: 20px;height: 20px" th:src="${member.via}" th:alt="${member.userName}">
                            <div class="flex-grow-1 ms-1">
                                <span class="mt-0" th:text="${member.userName}" ></span>
                                <span th:include="fragments/profile::memberActive(${member.active})"></span>
                            </div>
                        </a>
                    </div>
                    <div th:if="${#lists.isEmpty(commonPageIndexDto.memberList)}" th:include="fragments/index::empty_content"></div>
                </div>
                <div class="card card-body shadow-sm border-bottom border-2 border-top-0 border-start border-end-0 p-2 my-2">
                    <a class="text-secondary" href="/view/history"><span th:include="fragments/icon::view_record"></span>浏览记录</a>
                </div>
                <div th:include="fragments/index::google_right_ad"></div>
        </div>
        </div>
    </div>
</div>
</html>
